<template>
  <div class="top">
    <div class="bottom_left">
      <span class="lbtn" @click="goHome">首页</span>
    </div>
    <div class="center">
      <div class="title">实时利润可视化大数据平台</div>
    </div>
    <div class="right">
      <span class="lbtn">统计报告</span>
      <span class="rbtn">当前时间 {{ time }}</span>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
//@ts-ignore
import moment from 'moment'
import { onMounted, onBeforeUnmount, ref } from 'vue'
let $router = useRouter()
const goHome = () => {
  $router.push('/home')
}
let time = ref(moment().format('YYYY-MM-DD HH:mm:ss'))
let timer = ref()
onMounted(() => {
  timer.value = setInterval(() => {
    time.value = moment().format('YYYY-MM-DD HH:mm:ss')
  }, 1000)
})
onBeforeUnmount(() => {
  clearInterval(timer.value)
})
</script>

<style lang="scss" scoped>
.top {
  display: flex;
  width: 100%;
  height: 40px;
  .bottom_left,
  .right {
    flex: 1;
    background: url('../images/dataScreen-header-left-bg.png') no-repeat;
    background-size: 100% 100%;
    display: flex;
    justify-content: flex-end;
    .lbtn {
      line-height: 40px;
      text-align: center;
      width: 100px;
      height: 40px;
      background: url('../images/dataScreen-header-btn-bg-l.png');
      color: #29fcff;
      font-size: 20px;
      cursor: pointer;
      user-select: none;
    }
  }
  .right {
    flex: 1;
    justify-content: space-between;
    align-items: center;
    .rbtn {
      user-select: none;
      width: 200px;
      height: 40px;
      color: #29fcff;
      font-size: 12px;
      background: url('../images/dataScreen-header-btn-bg-r.png') no-repeat;
      background-size: 100% 100%;
      line-height: 40px;
      text-align: center;
    }
  }
  .center {
    flex: 3;
    .title {
      width: 100%;
      height: 74px;
      background: url('../images/dataScreen-header-center-bg.png') no-repeat;
      background-size: 100% 100%;
      text-align: center;
      line-height: 74px;
      color: #29fcff;
      font-size: 32px;
    }
  }
}
</style>
